package com.lcm.basic.p7.list;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

/**
 * @author Coder-lcm
 * @date 2021/4/3
 */
public class ListIteratorDemo {
    public static void main(String[] args) {
        List books = new ArrayList();
        books.add("dadad");
        books.add("Dadada");

        ListIterator iterator = books.listIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
            iterator.add("----分隔符--"); //在指定位置插入
        }

        System.out.println("========反向迭代===========");
        while (iterator.hasPrevious()) {
            System.out.println(iterator.previous());
        }

        ArrayList<Integer> arrayList = new ArrayList<>();

    }
}
